//
//  ModuleView.m
//  dyseller
//
//  Created by 红喇叭 on 2017/6/1.
//  Copyright © 2017年 红喇叭. All rights reserved.
//

#import "ModuleView.h"

@implementation ModuleView

- (instancetype)initWithModeleView:(CGRect)frame title:(NSString *)title imagename:(NSString *)name{
    self = [super initWithFrame:frame];
    if (self) {
        [self createView:title imagename:name];
    }
    return self;
}

- (void)createView:(NSString *)title imagename:(NSString *)name {
    _btnimage = [[UIImageView alloc] init];
    [_btnimage setImage:[UIImage imageNamed:name]];
    [self addSubview:_btnimage];
    _btnimage.sd_layout.leftSpaceToView(self, self.width/3).topSpaceToView(self, self.height/3).rightSpaceToView(self, self.width/3).heightIs(self.height/3);
    
    _btntitle = [[UILabel alloc] init];
    _btntitle.text = title;
    _btntitle.textColor = [UIColor darkGrayColor];
    _btntitle.textAlignment = NSTextAlignmentCenter;
    [self addSubview:_btntitle];
    _btntitle.sd_layout.leftSpaceToView(self, 0).rightSpaceToView(self, 0).topSpaceToView(_btnimage, 10).heightIs(20);
    
    
}

@end
